LanguageExt.Core

LanguageExt.Core Monads State and Environment Monads Reader Reader

Contents

record Reader <Env, A> (Func<Env, A> runReader) Source #

Reader monad transformer, which adds a static environment to a given monad.

Parameters

type Env

Reader environment type

type M

Given monad trait

type A

Bound value type

param runReader

Transducer that represents the transformer operation

Methods

method Reader<Env, A> Pure (A value) Source #

Lift a pure value into the monad-transformer

Parameters

param value

Value to lift

returns

Reader

method Reader<Env, A> Asks (Func<Env, A> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

Reader

method Reader<Env, A> AsksM (Func<Env, Reader<Env, A>> f) Source #

Extracts the environment value and maps it to the bound value

Parameters

param f

Environment mapping function

returns

Reader

method Reader<Env, A> Lift (Pure<A> monad) Source #

Lifts a given monad into the transformer

Parameters

param monad

Monad to lift

returns

Reader

method Reader<Env, A> Lift (Func<A> f) Source #

Lifts a unit function into the transformer

Parameters

param f

Function to lift

returns

Reader

method Reader<Env1, A> With <Env1> (Func<Env1, Env> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

Reader

method Reader<Env, A> Local (Func<Env, Env> f) Source #

Maps the Reader's environment value

Parameters

param f

Mapping function

returns

Reader

method Reader<Env, B> Map <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping function

returns

Reader

method Reader<Env, B> Select <B> (Func<A, B> f) Source #

Maps the bound value

Parameters

type B

Target bound value type

param f

Mapping transducer

returns

Reader

method Reader<Env, B> Bind <B> (Func<A, K<Reader<Env>, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

Reader

method Reader<Env, B> Bind <B> (Func<A, Reader<Env, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

Reader

method Reader<Env, B> Bind <B> (Func<A, Ask<Env, B>> f) Source #

Monad bind operation

Parameters

type B

Target bound value type

param f

Mapping function

returns

Reader

method Reader<Env, C> SelectMany <B, C> (Func<A, K<Reader<Env>, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

Reader

method Reader<Env, C> SelectMany <B, C> (Func<A, Reader<Env, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

Reader

method Reader<Env, C> SelectMany <B, C> (Func<A, Pure<B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

Reader

method Reader<Env, C> SelectMany <B, C> (Func<A, Ask<Env, B>> bind, Func<A, B, C> project) Source #

Monad bind operation

Parameters

type B

Intermediate bound value type

type C

Target bound value type

param bind

Monadic bind function

param project

Projection function

returns

Reader

method A Run (Env env) Source #

Run the reader monad

Parameters

param env

Input environment

returns

Bound monad

class ReaderExt Source #

Reader monad extensions

Methods

method Reader<Env, A> As <Env, A> (this K<Reader<Env>, A> ma) Source #

method Reader<Env, A> Flatten <Env, A> (this Reader<Env, Reader<Env, A>> mma) Source #

Monadic join

class Reader Source #

Methods

method Reader<Env, B> bind <Env, A, B> (Reader<Env, A> ma, Func<A, Reader<Env, B>> f) Source #

method Reader<Env, B> map <Env, A, B> (Func<A, B> f, Reader<Env, A> ma) Source #

method Reader<Env, A> Pure <Env, A> (A value) Source #

method Reader<Env, B> apply <Env, A, B> (Reader<Env, Func<A, B>> mf, Reader<Env, A> ma) Source #

method Reader<Env, B> action <Env, A, B> (Reader<Env, A> ma, Reader<Env, B> mb) Source #

method Reader<Env, Env> ask <Env> () Source #

method Reader<Env, A> asks <A, Env> (Func<Env, A> f) Source #

method Reader<Env, A> asksM <Env, A> (Func<Env, Reader<Env, A>> f) Source #

method Reader<Env, A> local <Env, A> (Func<Env, Env> f, Reader<Env, A> ma) Source #

class Reader <Env> Source #

Trait implementation for Reader

Parameters

type Env

Reader environment type